<?php
class ControllerModuleMebuuSupportonlineHome extends Controller {
	public function update() {
		$this->load->model('catalog/information');
		$this->data['yahoos'] = array();
		$html = '';
		//yahoo
		$yahoo = new yahoo();	
		foreach ($this->model_catalog_information->getInformations2('yahoo') as $result) {
		
			
			/*
      		$this->data['yahoos'][] = array(
        		'title' => $result['title'],
				'nick_chat' => $result['nick_chat'],
				'status' => $yahoo->Get_status($result['nick_chat'])
	    		
      		);
			*/
			if($yahoo->Get_status($result['nick_chat'])) {
				
				$html .='<a href="ymsgr:sendIM?'.$result['nick_chat'].'" title="My Yahoo id: '.$result['nick_chat'].'"><img src="catalog/view/theme/default/img/ym_online.png" alt=""/></a>';
			} else {
				$html .='<a href="ymsgr:sendIM?'.$result['nick_chat'].'" title="My Yahoo id: '.$result['nick_chat'].'"><img src="catalog/view/theme/default/img/ym_offline.png" alt=""/></a>';
			}
    	}
		
		//skype
		$this->data['skypes'] = array();
		foreach ($this->model_catalog_information->getInformations2('skype') as $result) {
		
			//$yahoo = new yahoo();
			/*
      		$this->data['skypes'][] = array(
        		'title' => $result['title'],
				'nick_chat' => $result['nick_chat'],
				'status' => $yahoo->getSkypeStatus($result['nick_chat'])
	    	);
			*/
			if($yahoo->getSkypeStatus($result['nick_chat']) == 'Online' ) {
				$html .='<a href="skype:'.$result['nick_chat'].'?chat" title="My skype id: '. $result['nick_chat'].'"><img src="catalog/view/theme/default/img/skype_online.png" alt=""/></a>';
			} else {
				$html .='<a href="skype:'.$result['nick_chat'].'?chat" title="My skype id: '. $result['nick_chat'].'"><img src="catalog/view/theme/default/img/skype_offline.png" alt=""/></a>';
			}
    	}
		echo $html;
	}
	protected function index() {
		$this->language->load('module/about');
		
      	$this->data['heading_title'] = $this->language->get('heading_title');
		
		$this->load->model('catalog/information');
		
		//hotline
		$information_info = $this->model_catalog_information->getInformation(62);
		$this->data['title'] = $information_info['title'];	
		$this->data['description'] = html_entity_decode($information_info['description'], ENT_QUOTES, 'UTF-8');
		
		
		
		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/mebuu_supportonline_home.tpl')) {
			$this->template = $this->config->get('config_template') . '/template/module/mebuu_supportonline_home.tpl';
		} else {
			$this->template = 'default/template/module/mebuu_supportonline_home.tpl';
		}

		$this->render();
	}
}
?>